local skel = fk.CreateSkill {
  name = "emo__yongzhe",
  tags = {Skill.Permanent, Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__yongzhe"] = "勇者",
  [":emo__yongzhe"] = "持恒技，每轮开始时，若你不为AI，获得一个<a href=':emo_talents'>“战法”</a>。",

  ["$emo__yongzhe1"] = "（叮）",
}

local EmoTalentUtil = require "packages.emopack.pkg.emopack_talent.util" -- 加载战法核心

--- 技能主体部分。每轮开始时，获得1个战法
skel:addEffect(fk.RoundStart, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and player.id > 0
  end,
  on_use = function (self, event, target, player, data)
    local round = player.room:getBanner("RoundCount")
    local params = {}
    if not player.tag["emo__yongzhe_gift"] then
      params = { rarity_limit = {4}, num = 8 }
      player.tag["emo__yongzhe_gift"] = true
    elseif round then
      local list = {2, 1, 2, 3, 1}
      local i = (round - 1) % #list + 1
      params = { rarity = list[i] }
    end
    EmoTalentUtil.discoverTalent(player, params)
  end,
})

skel:addAcquireEffect(function (self, player)
  EmoTalentUtil:attachTalent(player)
end)

return skel
